﻿using System;
using System.Linq;
using System.Text;
using System.Data;
using System.Collections.Generic;

namespace WS.DAL
{
    using SKG.DAL;

    public abstract class DanhmucDAL : BaseDAL, IBase
    {
        #region Implement
        public int Count()
        {
            throw new NotImplementedException();
        }

        public object Select(string code)
        {
            throw new NotImplementedException();
        }

        public DataTable Select(Guid fKey)
        {
            throw new NotImplementedException();
        }

        public DataTable Select(object obj = null, int skip = 0, int take = 0)
        {
            return Mapper.QueryForDataTable("Danhmuc_Select", null);
        }

        public object Insert(object obj)
        {
            return _sqlMapper.Insert("Danhmuc_Insert", obj);
        }

        public object Update(object obj)
        {
            return _sqlMapper.Update("Danhmuc_Update", obj);
        }

        public object Delete(Guid id = new Guid())
        {
            try
            {
                return _sqlMapper.Delete("Danhmuc_Delete", id);
            }
            catch (Exception)
            {
                return 0;
            }
        }
        #endregion

        public DataTable Select_Loai(string loai)
        {
            return Mapper.QueryForDataTable("Danhmuc_Select_By_Loai", loai);
        }

        public DataTable Select_Parent(Guid id)
        {
            return Mapper.QueryForDataTable("Danhmuc_Select_By_Parent", id);
        }
    }
}